package priv.pattern.staticproxy.staticagency;

import org.junit.Test;
import priv.pattern.staticproxy.staticagency.service.impl.AccountIServiceImpl;

/*
 * 作者：m鹏h
 * 时间；2024/7/24 22:01
 * 描述：静态代理测试类
 **/
public class StartStaicProxyTest {
 /*
 * 一个静态代理类只能对一个业务接口的实现类进行包装，如果有个业务接口的话，就需要创建多个代理类，不方便
 * 使用动态代理
 * */
 @Test
 public void test(){
  AccountIServiceImpl accountIServiceImpl = new AccountIServiceImpl();
  AccountProxy accountProxy = new AccountProxy(accountIServiceImpl);
  //根据代理类对象调用对应方法
  accountProxy.queryAccount();
  System.out.println("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
  accountProxy.updateAccount();
 }
}
